<?php

require_once BaseUtil::getModulePath("base") . '/forms/BaseForm.php';
require_once BaseUtil::getModulePath("base") . '/validate/Unique.php';

class ConfigForm extends BaseForm {
    public function __construct($edit = false,$key = null) {
        parent::__construct();
        if($edit) {
            $this->setAction(HttpUtil::getUrl("config","subedit"));
        }else {
            $this->setAction(HttpUtil::getUrl("config","subadd"));
        }

        $verificationEmail = new Zend_Form_Element_Text('verification_email');
        $verificationEmail->setLabel($this->translate->_('verificationEmail'));
        $verificationEmail->addFilter("StringTrim");
        $verificationEmail->setRequired(true);

        $templateName = new Zend_Form_Element_Text('template_name');
        $templateName->setLabel($this->translate->_('templateName'));
        $templateName->addFilter("StringTrim");
        $templateName->setRequired(true);

        $shppingRate1 = new Zend_Form_Element_Text('shipping_rate_1');
        $shppingRate1->setLabel($this->translate->_('shippingRate1'));
        $shppingRate1->addFilter("StringTrim");
        $shppingRate1->setRequired(true);

        $shppingRate2 = new Zend_Form_Element_Text('shipping_rate_2');
        $shppingRate2->setLabel($this->translate->_('shippingRate2'));
        $shppingRate2->addFilter("StringTrim");
        $shppingRate2->setRequired(true);

        $shppingRate3 = new Zend_Form_Element_Text('shipping_rate_3');
        $shppingRate3->setLabel($this->translate->_('shippingRate3'));
        $shppingRate3->addFilter("StringTrim");
        $shppingRate3->setRequired(true);

        $shppingRate4 = new Zend_Form_Element_Text('shipping_rate_4');
        $shppingRate4->setLabel($this->translate->_('shippingRate4'));
        $shppingRate4->addFilter("StringTrim");
        $shppingRate4->setRequired(true);

        $shppingRate5 = new Zend_Form_Element_Text('shipping_rate_5');
        $shppingRate5->setLabel($this->translate->_('shippingRate5'));
        $shppingRate5->addFilter("StringTrim");
        $shppingRate5->setRequired(true);

        $this->addElements(array($verificationEmail,$templateName,$shppingRate1,$shppingRate2,$shppingRate3,$shppingRate4,$shppingRate5));
        $this->setElementDecorators(array('ViewHelper',array(array('div' =>'HtmlTag'),array('tag' =>'div',"class" => "form_element"))));
    }
}